export class String {
  public static isNullOrEmpty(value: string | null | undefined) {
    return value === null || value === undefined || value === "";
  }

  public static isNullOrWhitespace(value: string | null | undefined) {
    return String.isNullOrEmpty(value) || String.isNullOrEmpty(value.trim());
  }

  public static getQueryString(obj: object): string {
    if (obj == null) {
      return "";
    }

    const params = new URLSearchParams();
    for (const key in obj) {
      if (Object.prototype.hasOwnProperty.call(obj, key)) {
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        params.append(key, (obj as any)[key]);
      }
    }
    return params.toString();
  }
}
